import { BasicColumn, FormSchema } from '@/components/Table';
import { h, ref } from 'vue';
import { Tag } from 'ant-design-vue';
import {VxeFormItemProps, VxeGridPropTypes} from "@/components/VxeTable";
import util from "@/utils/util";



/**
 */
export const vxeTableColumns: VxeGridPropTypes.Columns = [
  {
    title: 'today',
    field: 'week',
    headerAlign: 'center',
    children: [
      { field: 'from', title: 'From', showOverflow: 'title',align: 'center' },
      { field: 'to', title: 'To', showOverflow: 'title', align: 'center' },
      { field: 'duration', title: 'duration', showOverflow: 'title', align: 'center' },
    ]
  },
  {
    title: 'Target',
    field: 'target',
    headerAlign: 'center',
    children: [
      { field: '100', title: '100', showOverflow: 'title', align: 'center',slots: {
          footer: "footer_100"
        } },
      { field: '200_500', title: '200/500', showOverflow: 'title', align: 'center',slots: {
          footer: "footer_200_500"
        } },
      { field: 'step', title: '计步器', showOverflow: 'title',align: 'center',slots: {
          footer: "footer_step"
        } },
      { field: 'K950', title: 'K950', showOverflow: 'title',align: 'center',slots: {
          footer: "footer_K950"
        } }
    ]
  },

];


export const baseColumns: VxeGridPropTypes.Columns = [
  {
    title: '1线',
    field: 'lineName',
    headerAlign: 'center',
    children: [
      {
        title: '时段',
        field: 'timeRank',
        showOverflow: 'title',
        align: 'center',
        width:72
      },
      {
        title: '型号',
        field: 'model',
        showOverflow: 'title',
        width:100,
        slots: {
          default:"model_default",
        },
        align: 'center',
      },
      {
        title: '数量',
        field: 'num',
        align: 'center',
        width:80,
        slots: {
          default:"num_default",
          footer: "footer_num"
        }
      },
      {
        title: '颜色',
        field: 'guige',
        width:80,
        slots: {
          default:"guige_default"
        },
        align: 'center',
      },
      {
        title: '订单标识号',
        field: 'biaoShiHao',
        slots: { default: 'orderNo_slot' },
        showOverflow: 'title',
        align: 'center',
        // width:150,
      },
      {
        title: '日期',
        field: 'date',
        align: 'center',
        width: 30,
      },
      {
        title: '库位',
        field: 'tagText',
        slots: { default: 'tagText_slot' },

        align: 'center',
        width: 60,
      },
      {
        width: 60,
        title: '操作',
        align: 'center',
        field: '',
        slots: { default: 'action' },
        fixed: 'right',
      },
    ]
  }
];




export const formSchema: FormSchema[] = [
  {
    field: 'type',
    label: '人员类型',
    component:"Select",
    componentProps: {
      options: [
        { label: '管理人员', value: '管理人员' },
        { label: '技术人员', value: '技术人员' },
        { label: '其他人员', value: '其他人员' },
      ],
    },
    required: true,
  },
  {
    field: 'education',
    label: '学历/职称',
    component:"Input",
    required: true,
  },
  {
    field: 'workNum',
    label: '工作经验',
    component:"Input",
    required: true,
  },
  {
    field: 'manageNum',
    label: '管理经验',
    component:"Input",
    required: false,
  },
  {
    field: 'specialtyNum',
    label: '专业经验',
    component:"Input",
    required: true,
  },

  {
    field: 'specialtyMatching',
    label: '专业相符',
    component:"Input",
    required: true,
  },
  {
    field: 'history',
    label: '历史业绩',
    component:"Input",
    required: true,
  },


];



export const teamUserColumns: VxeGridPropTypes.Columns = [
  {
    title: '姓名',
    field: 'userName',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  {
    title: '标题',
    field: 'title',
    showOverflow: 'title',
    align: 'center',
    // width: 150,
  },
  {
    title: '审批结果',
    field: 'result',
    showOverflow: 'title',
    align: 'center',
    slots:{
      default({row}) {
        let color="",text="";
        if(row.result=='agree'){
          text="同意";
          color="green";
        }else{
          text=row.result;
        }
        return h(Tag,{color},text)
      },
    },
    width: 80,
  },
  {
    title: '审批编号',
    field: 'approveNo',
    showOverflow: 'title',
    align: 'center',
    width: 150,
  },
  {
    title: '发起时间',
    field: 'addTime',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  {
    title: '原职位',
    field: 'original_post',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  {
    title: '转入职位',
    field: 'now_post',
    showOverflow: 'title',
    align: 'center',
    width: 120,
  },
  // {
  //   width: 120,
  //   title: '操作',
  //   align: 'center',
  //   field: '',
  //   slots: { default: 'action' },
  //   fixed: 'right',
  // },
  ]


export const planListColumns: VxeGridPropTypes.Columns = [
  // {
  //   title: '订单分解编号',
  //   field: 'no',
  //   align: 'center',
  //   filters: [{ data: '' }],
  //   filterRender: {
  //     name: 'VxeInput',
  //   },
  //   showOverflow: 'title',
  //   width: 120,
  // },
  {
    title: '日期区间',
    field: 'dateRangke',
    align: 'center',
    width: 150,
    showOverflow: 'title',
  },
  {
    title: '订单标识号',
    field: 'biaoShiNos',
    align: 'center',
    filters: [{ data: '' }],
    filterRender: {
      name: 'VxeInput',
    },
    showOverflow: 'title',
    // width: 120,
  },

  {
    title: '创建人',
    field: 'userName',
    align: 'center',
    width: 100,
    showOverflow: 'title',
  },
  {
    title: '创建时间',
    // sortable: true,
    field: 'createTime',
    align: 'center',
    width: 130,
    showOverflow: 'title',
  },
  {
    width: 100,
    title: '操作',
    align: 'center',
    field: '',
    slots: { default: 'action' },
    fixed: 'right',
  },
];
